@echo off
echo 正在重置admin用户...
echo.

echo 方法1: 使用Django shell重置用户
python manage.py shell --settings=settings_ultra_minimal -c "
from django.contrib.auth.models import User;
try:
    user = User.objects.get(username='admin');
    user.set_password('admin123456');
    user.is_superuser = True;
    user.is_staff = True;
    user.is_active = True;
    user.save();
    print('✅ admin用户已重置');
    print('用户名: admin');
    print('密码: admin123456');
except User.DoesNotExist:
    user = User.objects.create_superuser('admin', 'admin@mes.com', 'admin123456');
    print('✅ 已创建新的admin用户');
    print('用户名: admin');
    print('密码: admin123456');
except Exception as e:
    print('❌ 重置失败:', e);
"

echo.
echo 完成！现在尝试使用以下信息登录：
echo 用户名: admin
echo 密码: admin123456
echo 网址: http://127.0.0.1:8000/admin/
echo.
pause 